package com.ccb.sc.common.modules.payment.enums;

import com.baomidou.mybatisplus.annotation.IEnum;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;

/**
 * 支付方式
 * @author Ken
 * @date 2020/7/10
 */
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
@Getter
public enum OrderType implements IEnum<Integer> {
    /**
     * 订单类型
     */
    POINTS(1, "积分订单"),
    MALL(2, "商城订单"),
    GROUPON(3, "团购订单"),
    ;

    private int value;
    private String desc;

    OrderType(int value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    @Override
    public Integer getValue() {
        return this.value;
    }

    public static OrderType getByValue(int value) {
        for (OrderType orderType : OrderType.values()) {
            if (value == orderType.getValue()) {
                return orderType;
            }
        }
        return null;
    }
}
